package cn.itcast.bos.repository;

import cn.itcast.bos.domain.system.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface RoleRepository extends JpaRepository<Role,Integer>,JpaSpecificationExecutor<Role> {


    @Query(value = "From Role r inner join fetch r.users u where u.id = ?")
    List<Role> findRolesByUserId(int id);
}
